<?php if(!defined('WANYA_ROOT')) {exit('error!');}?>
<div class=containertitle><b><?php echo $pwd; ?></b>
<?php if(isset($_GET['active_del'])):?><span class="actived">删除活动成功</span><?php endif;?>
<?php if(isset($_GET['active_add'])):?><span class="actived">添加活动成功</span><?php endif;?>
<?php if(isset($_GET['active_update'])):?><span class="actived">编辑活动</span><?php endif;?>
</div>
<form action="activity.php" method="post" name="form_act" id="form_act">
	<input type="hidden" name="activity_ID" id="activity_ID">
<div class=line></div>
	<fieldset style="border:2px solid #0099ff;">
		<legend>检索条件</legend>
		<table style="margin-bottom: 5px;margin-left: 10px">
<tr>
	<td>活动名称:</td>
	<td><input type="text" name="activity_name" id="activity_name" value="<?php echo($activity_name);?>"> </td>
	<td>　　<input type="button" value="检索" onclick="selectCommit()"></td>
	<td width="40px"></td>
	<td><a href="activity_update.php"></a><input type="button" value="活动添加" onclick="addCommit()"> </td>
</tr>
</table>
		</fieldset>
<div class=line></div>

  <table width="100%" id="adm_comment_list" class="item_list">
  	<thead>
      <tr>
	<th width="69" colspan="1"><b>选择</b></th>
        <th width="300" colspan="1"><b>活动名称</b></th>
		<th width="300" colspan="1"><b>报名截至时间</b></th>
        <th width="250"><b>操作</b></th>
      </tr>
    </thead>
    <tbody>
	<?php
	if($activies):
	foreach($activies as $key=>$value):
	?>
     <tr>
        <td width="19"><input type="checkbox" value="<?php echo $value['ID']; ?>" name="ids[]" class="ids" /></td>
	<td width="19"><?php echo $value['activity_name']; ?></td>
	<td width="19"><?php echo $value['activity_deadline']; ?></td>
 	<td width="19"><input type="button" value="编辑" onclick="updateCommit(<?php echo $value['ID']; ?>)"></td>

	<?php endforeach;else:?>
	  <tr><td class="tdcenter" colspan="4">还没有添加任何活动</td></tr>
	<?php endif;?>
	</tbody>
  </table>
	<div class="list_footer">
	<a href="javascript:void(0);" id="select_all">全选</a> 选中项：
    <a href="javascript:delCommit('del');" class="care">删除</a>
	<input name="operate" id="operate" value="" type="hidden" />
	</div>
    <div class="page"><?php echo $pageurl; ?> (共有<?php echo $activitiesNum; ?>个活动)</div>
	<input type="hidden" name="action" id="action">
</form>
<script>
$(document).ready(function(){
	$("#select_all").toggle(function () {$(".ids").attr("checked", "checked");},function () {$(".ids").removeAttr("checked");});
	$("#adm_comment_list tbody tr:odd").addClass("tralt_b");
	$("#adm_comment_list tbody tr")
		.mouseover(function(){$(this).addClass("trover");$(this).find("span").show();})
		.mouseout(function(){$(this).removeClass("trover");$(this).find("span").hide();})
});
setTimeout(hideActived,2600);
function delCommit(act){
	if (getChecked('ids') == false) {
		alert('请选择要删除的活动');
		return;
	}
	if(!confirm('你确定要删除所选活动吗？')){return;}
	$("#action").val("del");
	$("#form_act").submit();
}
function selectCommit(){
	$("#form_act").submit();
}
function updateCommit(activity_ID){
	$("#activity_ID").val(activity_ID);
	$("#action").val("update");
	$("#form_act").action="activity_update.php";
	$("#form_act").submit();
}

function addCommit(){

	$("#action").val("add");
	$("#form_act").action="activity.php";
	$("#form_act").submit();
}

$("#menu_cm").addClass('sidebarsubmenu1');
</script>